package com.dayatang.hrm.compensation.domain;

import java.util.Date;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorValue("2")
@NamedQueries( { @NamedQuery(name = "SalaryItemSetting.get", query = "select setting from SalaryItemSetting setting inner join setting.salaryCalItem o where (o = :pItem and setting.fromDate <= :pQueryDate and setting.toDate >= :pQueryDate)") })
public class SalaryItemSetting extends SalaryCalculateItemSetting {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7443132376219215169L;

	public SalaryItemSetting() {
	}

	public SalaryItemSetting(SalaryCalculateItem calItem) {
		setSalaryCalItem(calItem);
	}
	
	/*
	 * =======================================
	 * 
	 * action
	 * 
	 * ========================================
	 */

	public static SalaryItemSetting init(SalaryItem item) {
		return new SalaryItemSetting(item);
	}

	public static SalaryItemSetting get(SalaryItem item, Date queryDate) {
		return getSalaryCalItemSettingRepository().get(item, queryDate);
	}
}
